import HttpClient from '../utils/request';

import type { resourceReqTypa, resourceResType, resourceReqStateType, resourceResFormType, resourceReqFormType, classificationOpctionsType, classificationReqPramesType } from './../types/resourceTypa';

// 获取用户列表
export const getResourceList = (e: resourceReqTypa) => {
    return HttpClient.request<resourceResType>({
        url: '/platform/resources/getResourcesList',
        method: "POST",
        data: e,
        headers: {
            "Content-type": "application/json"
        }
    });
}
// 获取分类列表
export const getClassificationList = (e: classificationReqPramesType) => {
    return HttpClient.request<{ data: classificationOpctionsType[] }>({
        url: '/platform/category/getCategoryList',
        method: "POST",
        data: e,
        headers: {
            "Content-type": "application/json"
        }
    });
}
// 上架下架
export const updateResourcesStatus = (e: resourceReqStateType) => {
    return HttpClient.request({
        url: '/platform/resources/updateResourcesStatus',
        method: "POST",
        data: e,
        headers: {
            "Content-type": "application/json"
        }
    });
}
// 获取详情
export const getResourcesDetail = (e: { resourcesId: number }) => {
    return HttpClient.request<resourceResFormType>({
        url: '/platform/resources/getResourcesDetail',
        method: "POST",
        data: e,
        headers: {
            "Content-type": "application/json"
        }
    });
}

// 新增
export const createResources = (e: resourceReqFormType) => {
    return HttpClient.request<any>({
        url: '/platform/resources/createResources',
        method: "POST",
        data: e,
        headers: {
            "Content-type": "application/json"
        }
    });
}
// 编辑
export const updateResources = (e: resourceReqFormType) => {
    return HttpClient.request<any>({
        url: '/platform/resources/updateResources',
        method: "POST",
        data: e,
        headers: {
            "Content-type": "application/json"
        }
    });
}